#include<stdio.h>
/*
    Parameter passing by reference
    in C++, avoid use second pointer, "&" could make it better!
*/
void swap(int &a, int &b);

int main(int argc, char const *argv[])
{
    int a = 2;
    int b = 3;
    printf("before swap a: %d, b: %d\n", a, b);
    swap(a, b);
    printf("after swap a: %d, b: %d", a, b);
    return 0;
}

void swap(int &a, int &b) {
    int temp = a;
    a = b;
    b = temp;
}